﻿<cfsilent>
	<cfscript>
		
		dictAdvice = getProperty("serviceFactory").getBean("senateDictionaryAdvice");
		
		sql = "SELECT 
				  a.cid, a.course_name, 
				  a.course_code, a.course_credit, 
				  a.period, a.period_theory, 
				  a.period_practice, a.period_computer,
				  a.period_week, a.mark_mode,b.prop_name 
			  FROM t_course a  
				  INNER JOIN t_course_prop b ON b.prop_id = a.prop_id 
			  WHERE 
				  a.abandon = '0' 
				  AND length(a.course_code) > 8 
			  ORDER BY a.course_name  ";
          queryObj = new Query( datasource=application.dnsSlave );
		
          rs_course = queryObj.execute( sql=sql ).getResult();

		event.setArg("pageTitle", "教学运行基础数据 - 课程库查询");


		/* 搜索课程 */
		keyword = trim(event.getArg("Keywords"));
		
		//searchArray = [];
		rs_search = queryNew("cid");
		
		if ( len(keyword) ) {
		
			sql = "SELECT 
					  a.cid, a.course_name, 
					  a.course_code, a.course_credit, 
					  a.period, a.period_theory, 
					  a.period_practice, a.period_computer,
					  a.period_week, a.mark_mode,b.prop_name 
				  FROM t_course a  
					  INNER JOIN t_course_prop b ON b.prop_id = a.prop_id 
				  WHERE 
					  a.abandon = '0' 
					  AND length(a.course_code) > 8 
					  AND
					 (
						 a.course_code LIKE :condition 
						 OR 
						 a.course_name LIKE :condition 
					 )
				  ORDER BY a.course_name  ";
			queryObj = new Query( datasource=application.dnsSlave );
			queryObj.addParam( name="condition", value="%" & keyword & "%" , cfsqltype="cf_sql_varchar" );
			
			rs_course = queryObj.execute( sql=sql ).getResult();
		}
		
		currentTab = "labCourse";

	</cfscript>
</cfsilent>

<div id="headArea">
	<div class="uiHeader uiHeaderWithImage ptm">
		<div class="clearfix uiHeaderTop">
			<div class="uiHeaderActions rfloat">
				<a class="uiButton" href="<cfoutput>#buildURL('DEFAULT_EVENT')#</cfoutput>"><i class="mrs img btnPublish"></i><span class="uiButtonText">教学活动</span></a>
			</div>
			<div>
				<h2 class="uiHeaderTitle">
					<i class="uiHeaderImage img icon16x16 card"></i>海外学院课程开设情况
				</h2>
			</div>
		</div>
	</div>
</div>

<div class="UIElement">
	<ul class="senateFirstPage">
		<li>
			<div class="clearfix" id="summary">
				<div class="UItab">
					<div class="tabLables">
						<span <cfif currentTab eq "labCourse">class="active"</cfif> id="labCourse" tabTarget="Course">当前开设课程</span>
					</div>
				</div>
				<script language="javascript" type="text/javascript">
					//<![CDATA[
					<!--
					$(document).ready(function() {
						
						/* init Tab */
						$("div.tabContent").hide();
						$("div#" + $("div.tabLables span.active").attr("tabTarget")).show();
						
						$("div.tabLables > span").click(function(){
							var $targetID = $(this).attr("tabTarget");
							
							$("div.tabLables span").removeClass("active");
							$(this).addClass("active");
							
							$("div.tabContent").not('[id="' + $targetID + '"]').hide();
							$("div.tabContent#" + $targetID).show();
						});
						
					});
					// -->
					//]]>
				</script>
				<div id="Course" class="tabContent">
					
                         <form id="formSearch" onSubmit="javascript:return processVerfiyForm('formSearch');" class="formWrapper Transparent" method="post" action="<cfoutput>#buildURL('courseByDepartment')#</cfoutput>">
                                   
                                   <div class="label">
                                        <b>课程名或者课程号</b>
                                        <input name="Keywords" id="Keywords" type="text" class="typeText" verification="required" maxlength="128" value="<cfoutput>#trim(event.getArg('Keywords'))#</cfoutput>" >
                                   </div>
                                 
                                   <div class="lable">
                                        <input class="button1" type="submit" value="搜索" />
                                   </div>
                              </form>
                              
                        <cfset row = 0 />
                        <table class="UIEditable">
                             <thead>
                                  <tr>
                                       <td width="18"></td>
                                       <td width="80">课程号</td>
                                       <td>课程</td>
                                       <td width="50" align="center">类别</td>
                                       <td width="24" align="center">学分</td>
                                       <td width="50" align="center">计分</td>
                                       <td width="36" align="center">总学时</td>
                                       <td width="24" align="center">理论</td>
                                       <td width="24" align="center">实践</td>
                                       <td width="24" align="center">上机</td>
                                       <td width="36" align="center">周学时</td>
                                  </tr>
                             </thead>
                             <tbody>
                          <cfloop query="rs_course" >
                                       <cfset row ++ />
                                       <tr class="editRows <cfif event.getArg('CID') eq rs_course.cid> lastEdited</cfif>">
                                            <td><span class="index"><cfoutput>#row#</cfoutput></span></td>
                                            <td><span class="numeric"><cfoutput>#rs_course.course_code#</cfoutput></span></td>
                                            <td><cfoutput>#rs_course.course_name#</cfoutput></td>
                                            <td align="center"><cfoutput>#rs_course.prop_name#</cfoutput></td>
                                            <td align="center"><span class="numeric"><cfoutput>#numberFormat(rs_course.course_credit, "0.0")#</cfoutput></span></td>
                                            <td align="center"><cfoutput>#dictAdvice.getMarkModeName(rs_course.mark_mode)#</cfoutput></td>
                                            <td align="center"><span class="numeric"><cfoutput>#rs_course.period#</cfoutput></span></td>
                                            <td align="center"><span class="numeric"><cfoutput>#rs_course.period_theory#</cfoutput></span></td>
                                            <td align="center"><span class="numeric"><cfoutput>#rs_course.period_practice#</cfoutput></span></td>
                                            <td align="center"><span class="numeric"><cfoutput>#rs_course.period_computer#</cfoutput></span></td>
                                            <td align="center"><span class="numeric"><cfoutput>#numberFormat(rs_course.period_week,"__")#</cfoutput></span></td>
                                       </tr>
                                  </cfloop>
                             </tbody>
                        </table>
                   
				</div>
				
			
			</div>
		</li>
	</ul>
</div>


